{% extends "../main.html" %}
{% block head_js %}
<link href="{{static_url('datatable/jquery.dataTables.css')}}" rel="stylesheet">
<!--link href="http://cdn.datatables.net/1.10.0/css/jquery.dataTables.css" rel="stylesheet"-->
<style type="text/css">
document.getElementById("uploadBtn").onchange = function () {
    document.getElementById("uploadFile").value = this.value;
};
#red {color: red;}
#blue {color: blue;}
#orange {color: orange;}
#green {color: green;}
a {color: inherit;}

</style>
{% end %}
{% block nem %}
<ul class="nav nav-sidebar">
    <li><a href="/users">用户管理</a></li>
    <li class=""><a href="/users/add">添加用户</a></li>
    <li class="active"><a href="/users_group">组管理</a></li>
    <li><a href="/users/update">更新</a></li>
</ul>

{% end %}
{% block bodyy %}
<h3 class="sub-header" content="">主机组列表</h3>
<form class="form-horizontal" method="post">
    <table>
        <tr>
            <td>
                <input type="text" class="form-control" placeholder="组名称" name="groupname">
            </td>
            <td>
                <button class="btn btn-primary" type="submit" name="cmd" value="add">添加主机组</button>
                <!--<button class="btn btn-primary" type="reset" name="cmd" value="reset">重置主机组</button>-->
            </td>
        </tr>
    </table>
</form>
<h2 class="sub-header"></h2>
<form method="post">
    <table id="hosts" class="table table-striped">
        <thead>
        <tr>
            <th>ID</th>
            <th>组名称</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for i in data %}
        <tr>
            <td>{{i[0]}}</td>
            <td>{{i[1]}}</td>
            <td>
                <!--button type="submit" class="btn btn-primary" name="id" value={{i[0]}}>编辑</button>
                     <button type="submit" class="btn btn-danger" name="delete" value="{{i}}">删除</button-->
                <a href="/hosts_group/update?id={{i[0]}}" class="btn btn-primary btn-xs">编辑</a>
                <a href="/delete/hosts_group/{{i[0]}}" class="btn btn-danger btn-xs">删除</a>
            </td>

        </tr>
        {% end %}

        </tbody>
    </table>

</form>

{% end %}
{% block body_js %}
<script src="{{ static_url('datatable/jquery.dataTables.min.js') }}"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#hosts').dataTable({
            "language": {
                "url": "{{ static_url('datatable/Chinese.json') }}"
            }
        });
    });

</script>
{% end %}
